1. Field
The following description relates to a virtual machine that uses a just-in-time compiler as a software execution environment.
2. Description of the Related Art
A virtual machine that may be used to run an application in a device that is equipped with heterogeneous central processing units (CPUs) and memories.
Code that is written in a high-level language may be distributed, for example, as a script or as hardware-independent intermediate code. The code may be executed by the interpreters or the machine language translators of virtual machines that are installed in various devices.
Examples of a virtual machine include a JAVA® virtual machine, which is widely used in mobile phones, digital TVs and the like. Other examples include a JAVASCRIPT® that is code that may be transmitted via the web, a DALVIK® virtual machine, and the like.
Various applications may be executed in various embedded devices such as mobile phones, digital TVs, servers, desktops, and the like, using virtual machines. Bytecode is generally distributed as execution code for a virtual machine to be run in diverse execution environments. The distributed bytecode may be executed by an interpreter. However, in executing bytecode, the interpreter is slower than when executing machine code. To prevent such a drawback and increase execution speed, a just-in-time compiler (JITC) may be utilized.
For example, the JITC may compile currently executed bytecode into machine code, store the machine code in a code cache of a virtual machine, and utilize the stored machine code while executing the compiled bytecode. The JITC may track a path from a certain position of bytecode in the course of running virtual machine, and generate machine code that corresponds to a predefined length of a bytecode trace.
The bytecode trace may be a segment of code of a predefined length of bytecode. The bytecode trace may prevent consumption of a large amount of time or the generation of an excessive amount of machine codes in the JITC.
A bytecode trace may be a target to be compiled by the interpreter for executing the bytecode. In this example, if an interpreter and the JITC are running as individual threads on different cores in a multi-core system, the JITC may not execute an operation until the bytecode trace is found by tracking a path and is compiled by the interpreter. Accordingly, a core allocated to the JITC may be left in an idle state.